package com.kly.collection.api;

import com.kly.collection.config.NacosConfig;
import com.kly.collection.db.dao.AgentDao;
import com.kly.collection.db.dao.CeAgentAccountDao;
import com.kly.collection.db.entity.AgentEntity;
import com.kly.collection.db.entity.CeAgentAccountEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class OkController {

    @Autowired
    private NacosConfig nacosConfig;

    @Autowired
    private AgentDao agentDao;

    @Autowired
    private CeAgentAccountDao agentAccountDao;

    @RequestMapping("/ok")
    public String ok() {
        return "ok";
    }

    @RequestMapping("/ip")
    public String getJpbRunIp() {
        return nacosConfig.getJobRunIp();
    }

    @RequestMapping("/db")
    public String testDb() {
        List<CeAgentAccountEntity> ceAgentAccountEntities = agentAccountDao.selectAllTest();
        return ceAgentAccountEntities.size()+"";
    }
}
